<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8" />
<title>服务中心列表</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<link rel="stylesheet" href="./css/font.css" th:href="@{/css/font.css}" />
<link rel="stylesheet" href="./css/xadmin.css" th:href="@{/css/xadmin.css}" />
<script type="text/javascript" src="/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
<script src="./lib/layui/layui.js" charset="utf-8" th:src="@{/lib/layui/layui.js}"></script>
<script type="text/javascript" src="./js/xadmin.js" th:src="@{/js/xadmin.js}"></script>
<script type="text/javascript" src="./js/xadmin.js" th:src="@{/js/jqPaginator.js}"></script>

</head>
<body>
	<!-- 顶部开始 -->
	<div class="container">
		<div class="logo">
			<a href="./index.html">服务中心后台管理</a>
		</div>
		<div class="left_open">
			<i title="展开左侧栏" class="iconfont">&#xe699;</i>
		</div>
		<ul class="layui-nav right" lay-filter="">
			<li class="layui-nav-item"><a href="javascript:;">admin</a>
				<dl class="layui-nav-child">
					<!-- 二级菜单 -->
					<dd>
						<a onclick="x_admin_show('个人信息','http://www.baidu.com')">修改密码</a>
					</dd>
					<dd>
						<a th:href="@{/layout}">退出</a>
					</dd>
				</dl></li>
			<li class="layui-nav-item to-index"><a href="/">前台首页</a></li>
		</ul>

	</div>

	<!-- 顶部结束 -->
	<!-- 中部开始 -->
	<!-- 左侧菜单开始 -->
	<div class="left-nav">
		<div id="side-nav">
			<ul id="nav"> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>会员管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/user/getList}"> <i class="iconfont"></i> <cite>会员列表</cite> </a></li> 
      </ul></li> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>健康指南</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/artType/getList}"> <i class="iconfont"></i> <cite>分类列表</cite> </a></li> 
       <li><a href="javascript:;"> <i class="iconfont"></i> <cite>资讯管理</cite> <i class="iconfont nav_right"></i> </a> 
        <ul class="sub-menu"> 
         <li><a th:href="@{/article/getList}"> <i class="iconfont"></i> <cite>资讯列表</cite> </a></li> 
         <li><a th:href="@{/artType/addArticle}"> <i class="iconfont"></i> <cite>资讯添加</cite> </a></li> 
        </ul></li> 
      </ul></li> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>医师管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/doctorType/query}"> <i class="iconfont"></i> <cite>职业分类列表</cite> </a></li> 
       <li><a th:href="@{/doctor/getList}"> <i class="iconfont"></i> <cite>加入申请列表</cite> </a></li> 
       <li><a th:href="@{/doctor/toAdd}"> <i class="iconfont"></i> <cite>医师增加</cite> </a></li> 
       <li><a th:href="@{/doctor/query}"> <i class="iconfont"></i> <cite>医师列表</cite> </a></li> 
      </ul></li> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>处方管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/illnessType/query}"> <i class="iconfont"></i> <cite>分类列表</cite> </a></li> 
       <li><a href="javascript:;"> <i class="iconfont"></i> <cite>处方管理</cite> <i class="iconfont nav_right"></i> </a> 
        <ul class="sub-menu"> 
         <li><a th:href="@{/recipe/query}"> <i class="iconfont"></i> <cite>处方列表</cite> </a></li> 
         <li><a th:href="@{/recipe/toAdd}"> <i class="iconfont"></i> <cite>处方添加</cite> </a></li> 
        </ul></li> 
      </ul></li> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>服务中心管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/area/query}"> <i class="iconfont"></i> <cite>区域列表</cite> </a></li> 
       <li><a href="javascript:;"> <i class="iconfont"></i> <cite>服务中心管理</cite> <i class="iconfont nav_right"></i> </a> 
        <ul class="sub-menu"> 
         <li><a th:href="@{/serviceCenter/query}"> <i class="iconfont"></i> <cite>服务中心列表</cite> </a></li> 
         <li><a th:href="@{/serviceCenter/toAdd}"> <i class="iconfont"></i> <cite>服务中心添加</cite> </a></li> 
        </ul></li> 
      </ul></li> 
       <li><a href="javascript:;"> <i class="iconfont"></i> <cite>订单管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/order/query}"> <i class="iconfont"></i> <cite>订单列表</cite> </a></li> 
      </ul></li> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>banner图管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/img/query}"> <i class="iconfont"></i> <cite>banner图列表</cite> </a></li> 
       <li><a th:href="@{/img/toAdd}"> <i class="iconfont"></i> <cite>banner图添加</cite> </a></li> 
      </ul> </li> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>保险管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/insurance/query}"> <i class="iconfont"></i> <cite>保险列表</cite> </a></li> 
        <li><a th:href="@{/userreceive/getList}"> <i class="iconfont"></i> <cite>保险领取会员列表</cite> </a></li> 
       <li><a th:href="@{/insurance/toAdd}"> <i class="iconfont"></i> <cite>保险添加</cite> </a></li> 
       <li><a th:href="@{/insuranceDetail/toAdd?type=1}"> <i class="iconfont"></i> <cite>报销说明管理</cite> </a></li>
       <li><a th:href="@{/insuranceDetail/toAdd?type=2}"> <i class="iconfont"></i> <cite>福利说明管理</cite> </a></li>
      </ul> </li> 
       <li><a href="javascript:;"> <i class="iconfont"></i> <cite>区块链管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/chain/toAdd}"> <i class="iconfont"></i> <cite>区块链管理</cite> </a></li> 
      </ul> </li> 
       <li><a href="javascript:;"> <i class="iconfont"></i> <cite>条款管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
         <li><a th:href="@{/insuranceDetail/toAdd?type=3}"> <i class="iconfont"></i> <cite>使用条款管理</cite> </a></li>
       <li><a th:href="@{/insuranceDetail/toAdd?type=4}"> <i class="iconfont"></i> <cite>隐私权政策管理</cite> </a></li>
      </ul> </li> 
    </ul> 
		</div>
	</div>
	<!-- <div class="x-slide_left"></div> -->
	<!-- 左侧菜单结束 -->
	<!-- 右侧主体开始 -->
	<div class="page-content">
		<div class="layui-tab tab" lay-filter="xbs_tab" lay-allowclose="false">
			<!--  <ul class="layui-tab-title">
            <li>我的桌面</li>
          </ul> -->
			<div class="layui-tab-content" style="margin-top: -30px;">
				<div class="layui-tab-item layui-show" style="overflow: scroll;">
					<!-- <div th:include="admin/welcome :: copy"></div> -->
					<div class="x-nav">
						<span class="layui-breadcrumb"> <a href="">首页</a> <a href="">服务中心管理</a> <a> <cite>服务中心列表</cite></a>
						</span> <a class="layui-btn layui-btn-small" style="line-height: 1.6em; margin-top: 3px; float: right" href="javascript:location.replace(location.href);" title="刷新"> <i class="layui-icon" style="line-height: 30px">ဂ</i></a>
					</div>

					<div class="x-body">
						<div class="layui-row">
							<form class="layui-form layui-col-md12 x-so" method="post" th:action="@{/serviceCenter/query}">
								<div class="layui-input-inline">
									<select id="areaId" name="areaId">
										<option value="0">所属区域</option>
              							<option th:each="data:${dataMap.areaList}" th:value="${data.id}" th:text="${data.name}" th:selected="${dataMap.areaId==data.id}"></option>
         	     				    </select></div>
								<input type="text" name="name" id="name" th:value="${dataMap.name}" placeholder="请输入服务中心名称" autocomplete="off" class="layui-input" />
								<button class="layui-btn" lay-submit="" lay-filter="sreach">
									<i class="layui-icon">&#xe615;</i>
								</button>
							</form>
						</div>
						<span class="x-right" style="line-height: 40px" th:text="'共有数据：'+${dataMap.total}+'条'"></span>

						<table class="layui-table">
							<thead>
								<tr>
									<th>ID</th>
									<th>名称</th>
									<th>所属区域</th>
									<th>经度</th>
									<th>纬度</th>
									<th>地址</th>
									<th>电话</th>
									<th>是否推荐</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<tr th:each="data,dataStat:${dataMap.data}">
									<td th:text="${dataStat.index+1}"></td>
									<td th:text="${data.name}"></td>
									<td th:text="${data.areaName}"></td>
									<td th:text="${data.longitude}"></td>
									<td th:text="${data.latitude}"></td>
									<td th:text="${data.address}"></td>
									<td th:text="${data.mobile}"></td>
									<td th:if="${data.isTop}==true"  class="td-status">
			            				<span class="layui-btn layui-btn-normal layui-btn-mini">
			            					<p th:id="status+${data.id}">已推荐</p>
										</span>
			            			</td>
			            			<td th:if="${data.isTop}==false"  class="td-status">
			            				<span class="layui-btn layui-btn-normal layui-btn-mini layui-btn-disabled">
			            					<p th:id="status+${data.id}">未推荐</p>
			            				</span>
			            			</td>
									<td class="td-manage"><a th:title="${data.isTop==true?'取消推荐':'推荐'}" th:onclick="'javascript:member_update(this,\''+${data.id}+'\');'" href="javascript:;"> 
									<i th:if="${data.isTop==true}" class="layui-icon">&#xe61a;</i>
									<i th:if="${data.isTop==false}" class="layui-icon">&#xe619;</i>
									<a title="编辑" th:href="@{/serviceCenter/detail(id=${data.id})}"> <i class="layui-icon">&#xe642;</i>
									</a> <a title="删除" th:onclick="'javascript:member_del(this,\''+${data.id}+'\');'" href="javascript:;"> <i class="layui-icon">&#xe640;</i>
									</a></td>
								</tr>
							</tbody>
						</table>
						<div class="page">
							<p id="p"></p>
							<div id="pagination"></div>
						</div>

					</div>
					<script th:inline="javascript">
    /*<![CDATA[*/
    	$(function(){
    		var name=$("#name").val();
    		var areaId=$("#areaId").val();
    	    $.jqPaginator('#pagination', {
    	        totalPages: [[${dataMap.totalPages}]],
    	        visiblePages: 2,
    	        currentPage: [[${dataMap.pageIndex}]],
    	        wrapper:'<ul class="pagination"></ul>',
    	        first: '<li class="first"><a href="/serviceCenter/query?pageIndex=1&name='+name+'&areaId='+areaId+'">首页</a></li>',
    	        prev: '<li class="prev"><a href="/serviceCenter/query?pageIndex='+[[${dataMap.pageIndex-1}]]+'&name='+name+'&areaId='+areaId+'">上一页</a></li>',
    	        next: '<li class="next"><a href="/serviceCenter/query?pageIndex='+[[${dataMap.totalPages}]]+'&name='+name+'&areaId='+areaId+'">下一页</a></li>',
    	        last: '<li class="last"><a href="/serviceCenter/query?pageIndex='+[[${dataMap.pageIndex+1}]]+'&name='+name+'&areaId='+areaId+'">末页</a></li>',
    	        page: '<li class="page"><a href="/serviceCenter/query?pageIndex={{page}}&name='+name+'&areaId='+areaId+'">{{page}}</a></li>',
    	        onPageChange: function (num) {
    	            //$('#p').text(num);
    	        	var total=[[${dataMap.totalPages}]];
    	        	var pageIndex=[[${dataMap.pageIndex}]];
    	            if(pageIndex==1){
    	            	$('.first a').attr('href','javascript:;;');//去掉标签中的onclick事件
    	            	$('.prev a').attr('href','javascript:;;');//去掉标签中的onclick事件
    	            }
    	            if(pageIndex==total){
    	            	$('.next a').attr('href','javascript:;;');//去掉标签中的onclick事件
    	            	$('.last a').attr('href','javascript:;;');//去掉标签中的onclick事件
    	            }
    	        }
    	    });
    	});
    	
    /*]]>*/
    </script>
	<script>
    /*置顶*/
    
    function member_update(obj,id){
    	var status = $("#status"+id).text();
    	if(status == '已推荐'){
    		  layer.confirm('确认要取消推荐吗？',function(index){
    	              //发异步把用户状态进行更改
    	               $.ajax({
    					    url:'/serviceCenter/updateStatus',
    					    type:'GET', //GET
    					    async:true,    //或false,是否异步
    					    data:{
    					    	id:id,
    					    	isTop:"0"
    					    },
    					    timeout:5000,    //超时时间
    					    dataType:'text',    //返回的数据格式：json/xml/html/script/jsonp/text
    					    success:function(data,textStatus,jqXHR){
    					    	if(data>0){
    					                layer.msg('已取消!',{icon: 1,time:2000});
    					                location.replace(location.href);
    					    	}else{
    					    		 layer.msg('取消失败!',{icon:5,time:2000});
    					    	}
    					    }
    					});
    	            
    	        });
    	}else{
    		  layer.confirm('确认要推荐吗？',function(index){
    	          	  $.ajax({
    					    url:'/serviceCenter/updateStatus',
    					    type:'GET', //GET
    					    async:true,    //或false,是否异步
    					    data:{
    					    	id:id,
    					    	isTop:"1"
    					    },
    					    timeout:5000,    //超时时间
    					    dataType:'text',    //返回的数据格式：json/xml/html/script/jsonp/text
    					    success:function(data,textStatus,jqXHR){
    					    	if(data>0){
    				                layer.msg('已推荐!',{icon: 1,time:2000});
    				                location.replace(location.href);
    					    	}else{
    					    		 layer.msg('推荐失败!',{icon:5,time:2000});
    					    	}
    					    }
    					});
    	             
    	            
    	        });
    	}
      
    }
    
    /*删除*/
    function member_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            //发异步删除数据
            $.ajax({
				    url:'/serviceCenter/delete',
				    type:'GET', //GET
				    async:true,    //或false,是否异步
				    data:{
				    	id:id
				    },
				    timeout:5000,    //超时时间
				    dataType:'text',    //返回的数据格式：json/xml/html/script/jsonp/text
				    success:function(data,textStatus,jqXHR){
				    	if(data>0){
				    		 $(obj).parents("tr").remove();
				              layer.msg('已删除!',{icon:1,time:1000});
				    	}else{
				    		 layer.msg('删除失败!',{icon:1,time:1000});
				    	}
				    }
				});

           
        });
    }
    
    </script>
				</div>
			</div>
		</div>
	</div>
	<div class="page-content-bg"></div>
	<!-- 右侧主体结束 -->
	<!-- 中部结束 -->
	<!-- 底部开始 -->
	<div class="footer">
		<div class="copyright">Copyright ©2017 x-admin v2.3 All Rights Reserved</div>
	</div>

</body>
</html>